package org.vectrics.user;

import java.io.Serializable;
import java.util.Date;

import org.vectrics.common.db.CodedObject;

public class UserPrivilegeType implements CodedObject, Serializable {

    public static final String GLOBAL_DATAOWNER_ACCESS = "domain.access";

    private static final long serialVersionUID = 1873444664285933667L;

    private String code = null;

    private boolean companyRole = false;

    private String description = null;

    private Date endDate = null;

    private boolean globalRole = true;

    private String name = null;

    private UserPrivilegeType parent = null;

    private Date startDate = null;

    private UserPrivilegeTypeGroup userPrivilegeTypeGroup = null;

    /**
     * @return Returns the code.
     */
    public String getCode() {
        return this.code;
    }

    /**
     * @return Returns the companyRole.
     */
    public boolean getCompanyRole() {
        return this.companyRole;
    }

    public String getDescription() {
        return this.description;
    }

    public Date getEndDate() {
        return this.endDate;
    }

    /**
     * @return Returns the globalRole.
     */
    public boolean getGlobalRole() {
        return this.globalRole;
    }

    public String getName() {
        return this.name;
    }

    /**
     * @return Returns the parent.
     */
    public UserPrivilegeType getParent() {
        return this.parent;
    }

    public Date getStartDate() {
        return this.startDate;
    }

    /**
     * @return Returns the userPrivilegeTypeGroup.
     */
    public UserPrivilegeTypeGroup getUserPrivilegeTypeGroup() {
        return this.userPrivilegeTypeGroup;
    }

    /**
     * @param code
     *            The code to set.
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @param companyRole
     *            The companyRole to set.
     */
    public void setCompanyRole(boolean companyRole) {
        this.companyRole = companyRole;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    /**
     * @param globalRole
     *            The globalRole to set.
     */
    public void setGlobalRole(boolean globalRole) {
        this.globalRole = globalRole;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param parent
     *            The parent to set.
     */
    public void setParent(UserPrivilegeType parent) {
        this.parent = parent;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @param userPrivilegeTypeGroup
     *            The userPrivilegeTypeGroup to set.
     */
    public void setUserPrivilegeTypeGroup(UserPrivilegeTypeGroup userPrivilegeTypeGroup) {
        this.userPrivilegeTypeGroup = userPrivilegeTypeGroup;
    }

    @Override
    public String toString() {
        return ("[name=" + this.getName() + "|code=" + this.getCode() + "|companyRole=" + this.companyRole
                + "|userPrivilegeTypeGroup" + this.userPrivilegeTypeGroup.getCode() + "]");
    }

}
